-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
non-admin user acess with usergroup #15489
non-admin user acess with usergroup #15489
Conversation
8387a61
to
5a8daf2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK after fixing Gaurav's good comments
5a8daf2
to
fb88a4f
Compare
tests/foreman/ui/test_ansible.py
Outdated
u_name = gen_string('alpha') | ||
ug_name = gen_string('alpha') | ||
password = gen_string('alpha') | ||
user = target_sat.api.User(login=u_name, password=password, admin=False).create() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use gen_string('alpha') here directly instead of u_name and use user.login
in test below? and same for usergroup?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used gen_string('alpha')
directly instead of creating a new variable for user and usergroup.
tests/foreman/ui/test_ansible.py
Outdated
wait_for(lambda: session.browser.refresh(), timeout=5) | ||
ansible_roles_table = session.host_new.get_ansible_roles(target_sat.hostname) | ||
assert ansible_roles_table[0]['Name'] == SELECTED_ROLE | ||
request.addfinalizer(user.delete) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you move this finalizer to the top immediately after user is created?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After creating the user, the finalizer was used
tests/foreman/ui/test_ansible.py
Outdated
ansible_roles_table = session.host_new.get_ansible_roles(target_sat.hostname) | ||
assert ansible_roles_table[0]['Name'] == SELECTED_ROLE | ||
request.addfinalizer(user.delete) | ||
assert user.login == u_name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert user.login == u_name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed this line.
tests/foreman/ui/test_ansible.py
Outdated
ug_name = gen_string('alpha') | ||
password = gen_string('alpha') | ||
user = target_sat.api.User(login=u_name, password=password, admin=False).create() | ||
target_sat.api.UserGroup(name=ug_name, user=[user], admin=True).create() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we verify is user is part of usergroup after usergroup is created?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assertion is added that user is part of usergroup
tests/foreman/ui/test_ansible.py
Outdated
result = target_sat.cli.Auth.logout() | ||
assert 'Logged out' in result |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove this as UI session will login with created user?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed this unnecessary logout
line
tests/foreman/ui/test_ansible.py
Outdated
@@ -519,6 +519,43 @@ def test_positive_assign_and_remove_ansible_role_to_hostgroup( | |||
session.hostgroup.delete(name) | |||
assert not target_sat.api.HostGroup().search(query={'search': f'name={name}'}) | |||
|
|||
@pytest.mark.tier3 | |||
def test_positive_non_admin_access( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we change this test name to something meaningful?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test name has been changed.
fb88a4f
to
f069dd2
Compare
trigger: test-robottelo |
PRT Result
|
trigger: test-robottelo |
"trigger": "test-robottelo" |
PRT Result
|
"trigger": "test-robottelo" |
PRT Result
|
non-admin user acess with usergroup (#15489) Bump tenacity from 8.4.2 to 8.5.0 (#15587) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> (cherry picked from commit 070b1dc) Co-authored-by: amolpati30 <[email protected]>
Bump tenacity from 8.4.2 to 8.5.0 (SatelliteQE#15587) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Problem Statement
With user which is non-admin but it is in usergroup which should give him administrator role is possible to access lot of pages, but giving Permission denied
Solution
It verifies if a non-admin user in the user group can access the WebUI.
Dependent PR: SatelliteQE/airgun#1461